package com.youku.expression.environment;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LocalEnvironment extends BaseEnvironment {

	private static final Logger logger = LoggerFactory.getLogger(LocalEnvironment.class);

	public LocalEnvironment(Environment outer) {
		super(outer);
	}

	@Override
	public Object get(String key) {
		Object value = super.get(key);
		if (value == null)
			value = getOuter().get(key);
		logger.debug("通过key:{}获取到value:{}", key, value == null ? "null" : value.toString());
		return value;
	}

	@Override
	public void putEnvironment(String id, Environment environment) {
		logger.debug("局部变量，不做任何处理");
	}

	@Override
	public Environment getEnvironment(String id) {
		logger.debug("局部变量环境，不做任何处理");
		return null;
	}

	@Override
	public void clearInner() {
	}

}
